package io.xxx.xbutler.event.job;

import lombok.extern.slf4j.Slf4j;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class JobConfig {

    @Bean
    public JobDetail robotRefreshJobDetail() {
        return JobBuilder.newJob(RobotRefreshJob.class)
                .withIdentity("robotRefreshJob")
                .storeDurably()
                .build();
    }

    @Bean
    public Trigger robotRefreshJobTrigger() {
        return TriggerBuilder.newTrigger()
                .withIdentity("robotRefreshJobTrigger")
                .forJob("robotRefreshJob")
                .withSchedule(CronScheduleBuilder.cronSchedule("0 30 0 * * ?"))
                .build();
    }
}
